<template>
  <div class="about">
    <!-- 头部 -->
    <InsideHeader></InsideHeader>

    <!-- memberInquiry -->
    <div class="memberInquiry memberBg">
      <div class="memberBlock">
        <div class="memberIndexN">
          <div class="memberIndexNC">
            <nuxt-link :to="{name: 'member'}">个人信息</nuxt-link>
            <nuxt-link :to="{name: 'member-memberInquiry'}" class="on">我的问询</nuxt-link>
            <nuxt-link :to="{name: 'member-memberElearning'}">我的elearning</nuxt-link>
            <nuxt-link :to="{name: 'member-collect'}">我的收藏</nuxt-link>
            <nuxt-link :to="{name: 'member-message'}">系统消息</nuxt-link>
            <div class="clear"></div>
          </div>
          <div class="clear"></div>
        </div>
        <div class="memberInquiryC">
          <div class="memberInquiryCO">
            <table class="memberInquiryCOT">
              <tr>
                <td>问询内容</td>
                <td width="20%">问询类别</td>
                <td width="15%">状态</td>
                <td width="20%">操作</td>
              </tr>
            </table>
            <table class="memberInquiryCOS" v-for="(item,index) in list" :key="index">
              <tr class="memberInquiryCOStit">
                <td colspan="4">
                  <h4>编号：{{item.inquiriesNo}}</h4>
                  <p>{{item.createTime}}</p>
                  <div class="clear"></div>
                </td>
              </tr>
              <tr>
                <td>{{item.content}}</td>
                <td width="20%">
                  {{item.area}}
                  <br />
                  {{item.type}}
                  <br />
                  {{item.product}}
                </td>
                <td width="15%">
                  <font v-if="item.status==1">已回复</font>
                  <font v-if="item.status==2">未回复</font>
                  <font v-if="item.status==3">已结束</font>
                </td>
                <td width="20%">
                  <nuxt-link
                    :to="{name: 'member-memberInquiryDetails',params:{ id: item.inquiriesNo,email:item.emai }}"
                  >查看详情</nuxt-link>
                  <em class="memberInquiryCOSdel" @click="memberInquiryCOSdel(item.oid)">删除</em>
                </td>
              </tr>
            </table>
            <p v-if="list.length==0" class="nodata">暂无数据</p>
          </div>
        </div>
      </div>
      <!-- 删除弹窗 -->
      <div class="memberInquiryCOSdelPUP">
        <div class="memberInquiryCOSdelPUPC">
          <em class="memberInquiryCOSdelPUPCclose" @click="memberInquiryCOSdelPUPCclose()">×</em>
          <div class="memberInquiryCOSdelPUPCE">
            <p>尊敬的会员：</p>
            <p>您确认删除此条问询吗？</p>
          </div>
          <div class="memberInquiryCOSdelPUPCB">
            <input
              type="reset"
              value="取消"
              @click="memberInquiryCOSdelPUPCclose()"
              class="memberInquiryCOSdelPUPCB2"
            />
            <input
              type="submit"
              value="确定"
              @click="memberInquiryCOSdelPUPCB1"
              class="memberInquiryCOSdelPUPCB1"
            />
            <div class="clear"></div>
          </div>
        </div>
      </div>
    </div>
    <!-- 底部 -->
    <HomeHooter></HomeHooter>
  </div>
</template>

<script>
import $ from "jquery";
import "@/assets/css/home.css";
import "@/assets/css/member.css";
import InsideHeader from "@/components/headuser";
import HomeHooter from "@/components/footer";
import Qs from "qs";
export default {
  name: "memberInquiry",
  data() {
    return {
      page: 1,
      list: [],
      userInfo: {}
    };
  },
  components: {
    InsideHeader,
    HomeHooter
  },
  methods: {
    getquerylist() {
      let id = this.$axios;
      let params = Qs.stringify({
        page: this.page,
        limit: 10,
        userOid: this.userInfo,
        emai: this.userInfo.email
      });
      this.$api.member.getqueryPage(id, params).then(res => {
        let result = res.data;
        if (result.code === 1) {
          this.list = result.data.data;
        }
      });
    },
    //删除问询
    memberInquiryCOSdelPUPCB1() {
      let id = this.$axios;
      let params = Qs.stringify({
        userOid: this.userInfo,
        inquiresInfoOid: this.oid
      });
      this.$api.member.delquery(id, params).then(res => {
        let result = res.data;
        if (result.code === 1) {
          this.$message({
            message: "删除成功",
            type: "warning"
          });
          this.getquerylist();
        }
      });
    },
    memberInquiryCOSdel(oid) {
      this.oid = oid;
      $(".memberInquiryCOSdelPUP").show();
    },
    memberInquiryCOSdelPUPCclose() {
      $(".memberInquiryCOSdelPUP").hide();
    }
  },
  mounted() {
    var userinfo;
    let _this = this;
    if (window) {
      userinfo = window.sessionStorage.getItem("userInfo");
    }
    if (userinfo) {
      this.userInfo = userinfo;
      this.getquerylist();
    } else {
      _this.$router.push("/enroll");
    }
  }
};
</script>
